// @vitest-environment jsdom // // The [locale] mirror page re-exports the bare page and adds getStaticPaths, // which tells `voltro build` which locale-prefixed paths to emit. The default // locale (en) is NOT listed — it lives at the bare path — so only /de is // produced. We also confirm the mirror re-exports the base page + its meta. import { describe, expect, test, vi } from 'vitest' // The mirror transitively imports the base page, which imports @voltro/i18n. // Stub it so importing the module doesn't require the real i18n runtime. vi.mock('@voltro/i18n', () => ({ // The locale catalogs call these at module top-level; identity mirrors the // real (compile-time-only) implementations so importing them doesn't throw. defineCatalog: (c: T): T => c, defineLocale: () => (c: T): T => c, T: ({ id }: { id: string }) => id, })) const indexMirror = await import('./page') describe('home mirror — getStaticPaths', () => { test('emits only non-default locales (just /de)', async () => { const paths = await indexMirror.getStaticPaths() expect(paths).toEqual([{ params: { locale: 'de' } }]) }) test('re-exports the base page component + its meta function', () => { expect(typeof indexMirror.default).toBe('function') expect(indexMirror.meta({ locale: 'de' }).title).toBe('Start') expect(indexMirror.renderMode).toBe('static') expect(indexMirror.interactive).toBe('none') }) })